package com.cloud.drore.eboss.supplier.mapper;

import com.cloud.drore.eboos.common.base.MyMapper;
import com.cloud.drore.eboos.common.entity.supplier.ProductRelation;
import com.cloud.drore.eboss.operation.entity.po.SupplierSettlementAutoInfoPo;
import com.cloud.drore.eboss.operation.entity.vo.SupplierSettlementInfoVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;


/**
 * 浙江卓锐科技股份有限公司 版权所有  Copyright 2018<br>
 *
 * @Description: <br>
 * @Project: eboos <br>
 * @CreateDate: Created in 2018/1/9 10:21 <br>
 * @Author: <a href="410508961@qq.com">夏凯</a>
 */
public interface SupplierSettlementAutoInfoMapper extends MyMapper<SupplierSettlementAutoInfoPo> {
    //查询供应商是否已经进行了结算信息的输入
    @Select("select count(1) from eboss_supplier_settlement_info where supplier_id=${id}")
    int querySupplierHasBeenSettlement(@Param("id") Long id);

    //查询满足条件可以进行结算的供应商
    @Select("select supplier_id,settlement_date,settlement_state from eboss_supplier_settlement_info ")
    List<SupplierSettlementInfoVo> querySupplierInfoList();

    //出现异常则将状态更改为1
    @Update("update eboss_supplier_settlement_info set settlement_state=1 where supplier_id=${id}")
    int updateupdateSupplierInfo(@Param("id") Long id);

    @Update("update eboss_supplier_settlement_info set settlement_state=1,modified_date='${stringDateTime}'")
    int updateSettlementFlag(@Param("stringDateTime") String stringDateTime);

    //
    @Update("update eboss_supplier_settlement_info set settlement_state=0,settlement_date='${date}' where supplier_id=${id}")
    int updateSettlementDate(@Param("id") Long id, @Param("date") String date);
}